- @pagetitle = 'Create Group'

.card.mb-3
  .card-body
    %h3= @pagetitle
    .col-lg-6.ps-0
      = form_for(Group.new, url: groups_path, method: :post) do |form|
        .mb-3
          = form.label(:title)
          = render partial: 'webui/shared/required_label_mark'
          = form.text_field(:title, class: 'form-control', required: true, autofocus: true)
        .mb-3
          = form.label(:email) do
            Email
            %small.form-text (not required for groups)
          = form.email_field(:email, class: 'form-control')
        .mb-3
          = label_tag(:members)
          -# TODO: refactor to use the _search_box partial
             WARNING: the .tag-input class is used by the tokenfield plugin and it interact with the HTML/CSS element
          = text_field_tag('group[members]', @members, id: 'group-members', class: 'form-control tag-input',
                                                       data: { source: autocomplete_users_path })
        = form.submit('Create', class: 'btn btn-primary', data: { disable_with: 'Creating...' })

- content_for :ready_function do
  initializeGroupTokenfield();
